#ifndef CART_MODEL_H_
#define CART_MODEL_H_

#include <cmath>
#include "model.h"
#include "point.h"
#include "path_iterator.h"
#include "ifollower.h"

class CartModel : public Model , public IFollower{
	private:
		static const float cartWidth;
		static const float cartHeight;
		static const float cartDepth;
		static const Point points[];
		static const unsigned int pointCount = 8;
		static const unsigned int indices[];
		static const unsigned int indexCount = 13;
	public:
		static const float lightPos[];
		static const float lightColor[];

		Point dir;
		Point pos;
		float xytheta;
		float yztheta;
		bool lightState;
		unsigned int lightId;
	public:
		CartModel(unsigned int lightId);
		~CartModel();

		void setLight(bool state){
			this->lightState = state;
		}

		bool getLightState(){
			return this->lightState;
		}

		unsigned int getLightId(){
			return this->lightId;
		}

		void updatePosition(const PathIterator& it);

		float getRotationAngleXY(){
			return this->xytheta*180/PI;
		}

		float getRotationAngleYZ(){
			return this->yztheta*180/PI;
		}

		unsigned int getPointCount(){
			return CartModel::pointCount;
		}

		unsigned int getIndexCount(){
			return CartModel::indexCount;
		}

		const unsigned int* getIndices(){
			return CartModel::indices;
		}

		const Point* getPoints(){
			return CartModel::points;
		}

		float getHeight(){
			return CartModel::cartHeight;
		}

		float getDepth(){
			return CartModel::cartDepth;
		}

		float getWidth(){
			return CartModel::cartWidth;
		}

		Point getPosition(){
			return this->pos;
		}

		void setPosition(const Point& p){
			this->pos=p;
		}

		const Point& getDirVector(){
			return this->dir;
		}

		const float* getLightPosition();
};

#endif /* CART_MODEL_H_ */
